package com.gjy.nwpufindseats;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.view.WindowManager;
public class Activity_Welcome extends Activity{
	
	//是否是第一次使用
		private boolean isFirstUse;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 
	setContentView(R.layout.welcome);
	new Thread(){
		public void run() {
			try {
				Thread.sleep(750);
				//读取SharedPreferences中需要的数据
				SharedPreferences preferences = getSharedPreferences("isFirstUse",MODE_PRIVATE);

		        isFirstUse = preferences.getBoolean("isFirstUse", true);
		        if (isFirstUse) {
		        	Bundle bundle = new Bundle();
					bundle.putBoolean("first", true);
					Intent intent = new Intent(Activity_Welcome.this, Activity_Guide.class);
					intent.putExtras(bundle);
					startActivity(intent);
				} else {
					startActivity(new Intent(Activity_Welcome.this, MainActivity.class));
				}
				finish();
				
				//实例化Editor对象
				Editor editor = preferences.edit();
		        //存入数据
		        editor.putBoolean("isFirstUse", false);
		        //提交修改
		        editor.commit();
			} catch (InterruptedException e) {

			}
		}
	}.start();
	}
	
	
}
